package com.hzw.code.net.exception

import com.hzw.code.net.IResource

/**
 *
 * @Author:         HuaZhongWei
 * @CreateDate:     2020/4/18 4:29 PM
 *
 * @Description:    APP资源相关异常
 *
 */
class ResourceException : Exception {

    val code: Int

    constructor(error: Error, throwable: Throwable? = null): super(error.msg, throwable) {
        code = error.code
    }

    constructor(code: Int, message: String, throwable: Throwable? = null): super(message, throwable) {
        this.code = code
    }

    constructor(code: Int, throwable: Throwable? = null): super(throwable) {
        this.code = code
    }

    constructor(resource: IResource<*>, throwable: Throwable? = null) : super(resource.message(), throwable) {
        this.code = resource.code()
    }
}
